package com.liaoban.app.ui.mine;

import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.liaoban.app.adapter.EarnListAdapter;
import com.liaoban.app.api.type.Earn;
import com.liaoban.app.api.type.request.EarnRequest;
import com.liaoban.app.biz.CommonBiz;
import com.liaoban.app.constants.Constant;
import com.liaoban.app.ui.base.BaseListActivity;

/**
 * Created by ybc on 2018/7/13 0013.
 * 我的收益
 */
public class EarnListActivity extends BaseListActivity<Earn> {
    @Override
    public String getNewTitle() {
        return "明细";
    }

    @Override
    public BaseQuickAdapter getAdapter() {
        return new EarnListAdapter(null);
    }

    @Override
    public void itemChildClick(BaseQuickAdapter baseQuickAdapter, View view, int position) {

    }

    @Override
    public void itemClick(BaseQuickAdapter baseQuickAdapter, View view, int position) {
        Earn earn = (Earn) baseQuickAdapter.getData().get(position);
        startActivity(EarnDetailActivity.newIntent(this, earn.getId() + "", earn.getType() + ""));
    }

    @Override
    public void getData() {
        EarnRequest earnRequest = new EarnRequest();
        earnRequest.setPage(getPageIndex() + "");
        earnRequest.setListRows(Constant.PAGE_SIZE + "");
        startTask(CommonBiz.getInstance().userMoney(earnRequest), listBaseResponse -> {
            doSuc(listBaseResponse.data, listBaseResponse.totalPageCount);
        });
    }
}
